package com.example.java_second_hand_market;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.stage.Screen;
import javafx.stage.Stage;

import java.io.IOException;

public class MainMarket extends Application {
    User us;
    int wid,hei;

    @Override
    public void start(Stage stage) throws IOException {      //启动函数
        Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
        System.setProperty("https.protocols", "TLSv1.2,TLSv1.3");
        int screenWid = (int)primaryScreenBounds.getWidth(), screenHei = (int)primaryScreenBounds.getHeight();
        wid= screenWid;
        hei=screenHei;
        LoginDialog ld=new LoginDialog(this,screenWid,screenHei);
        try
        {     Class.forName("com.mysql.cj.jdbc.Driver"); // 数据库装载
        }
        catch(Exception e)
        {     System.out.println("数据库装载失败: " + e.toString());
        }
    }

    public static void main(String[] args) {
        launch();
    }    //主函数
    public void loginasbuyer(String name,String account,String password){
         BuyerDialog buy=new BuyerDialog(new Buyer(name,account,password),wid,hei);
    }    //作为买家登录
    public void loginasseller(String name,String account,String password){
        SellerDialog sel=new SellerDialog(new Seller(name,account,password),wid,hei);
    }    //作为商家登录
    public void loginasadmin(String name,String account,String password){
        AdminDialog adm =new AdminDialog(new Admin(name,account,password),wid,hei);
    }      //作为管理员登录
}